• 200931 Aug

    Over the past few weeks I’ve received a number of emails from visitors to CSS3.info regarding CSS3 validation errors when using vendor specific extentions, for example -moz, -webkit, to implement CSS3 in their websites.

    This certainly isn’t a new topic, and in fact Joost de Valke first raised the issue on this website back in January 2007, however a glance over the W3C mailing-list archive highlights that this debate is still going strong, with a number of interesting ideas raised, and I thought it would make an interesting discussion point for the CSS3.info community.

    The problem is that, at present, none of the CSS3 modules have yet receached the status of becoming an official W3C Recommendation, as such any of these specifications could in theory be changed at time, particularly those that are still in the early stage of development.

    Obviously browser vendors (with the exception of course of our beloved friend Microsoft) are keen to support these up and coming CSS3 specifications, however as they are still at an “experimental” stage of development it is necessary for the various css3 properties to be implemented using vendor specific extensions in order to avoid any possible conflicts with current or future css specifications.

    Web designers are equally keen to implement these latest CSS3 techniques in their projects as browser support, along with interest from the wider community, continues to grow – a quick search around the blogosphere shows countless new CSS3 tutorials being added to the web on a weekly basis, and sites such as CSS3Gallery.net showcasing web designers putting CSS3 to great use in their projects. However many are facing a catch 22 situation, weighing up the pros and cons between utilising the latest that CSS3 has to offer against the fact that their creations won’t pass the W3C Validator, with some web designers even going so far as to question the importance of validation.

    When Joost De Valk brought this concern before the W3C back in January 2007, he was met with a somewhat muted response, however the debate has continued to intesify and a number of interesting suggestions have been put to the W3C:

    – That the CSS3 Validator could offer the option to ignore vendor specific extensions,

    – That the CSS3 Validator could highlight vendor specific extentions with a warning, rather than an error,

    – Or my own personal favourite, that the validator could mark such code as ‘experimental’ rather than error, or warning

    Either or these methods would allow web designers to continue to validate their pages, an important process for spotting any errors in your code, as despite some designers questioning the importance of validation, personally I think it’s a necessary and important tool.

    In the meantime, several web designers have suggested their own personal ways of overcoming the problem, with many commenting out CSS3 code until they have validated their pages, so that at least they can check the accuracy of their CSS2.1 code.

    In conclusion I’d like to say that, in my opinion, both sides of the argument present some valid points – obviously the W3c can’t be expected to validate what isn’t technically valid CSS, however perhaps the word ‘error’ is too strong, and marking vendor specific code with a ‘warning’ or ‘experimental’ status would be a happy medium between the needs of the W3C and designers eager to implement CSS3.

    At the same time, I have to question whether or not the time has yet come for designers to be implementing CSS3 in their client projects. I think CSS3 is perfectly acceptable to be used in a designer’s own projects, and quite essential to promote the growth of CSS3, but is it really acceptable to sell a client experimental code that could cease to function at any time if the W3C ammends a specification, or browser vendors change the syntax with which a property is implemented?

    Once again I turn the debate over to you, CSS3.info’s readers, how to you feel about this issue, and what’s the best solution from your point of view?

    You can skip to the end and leave a response.


  • Comments

    • 01.

      “so that at least they can check the accuracy of their CSS2.1 code.”

      There is a profile already on the W3C CSS3 validator for CSS3 (a dropdown in the ‘More Options’ area. That of course, won’t validate against browser specific CSS.

      Regarding validation, while it is important to me, I’m able to look past the -browser-prefix validation errors. I think some people are letting their OCD get the best of them when it comes to 100% validation and -browser-prefix validation errors.

      Another question is what to do with all the funky Microsoft specific CSS like CSS Expressions?

    • 02.

      Thank you kindly for the mention, much appreciated. We are constantly on the lookout for new sites daring to use css3 in their design. Hopefully over the coming months more and more lovely websites will be crafted and created using css3!

      If in the mean time you have any suggestions, please feel free to send them over to us.

      Our website is currently being designed and developed to its full potential and will be released mid September.

      All the best
      CSS3 Gallery

    • 03.

       While I have yet to move my own site into HTML5/CSS3, I have been testing client sites’ and new pages without any issues when utilizing -moz, -webkit, -khtml extensions. It may be the Validation Tool. I suggest, http://validator.nu/ . Check whether version 3 of the tool is loading.

    • 04.

      Seems like a trivial issue… if they’re that worried about validation, simply include all of the browser specific, non-validating properties in a separate stylesheet, and either keep them there, or only integrate them with the other stylesheets after validation has passed.

      [Or better yet, just keep them integrated, and learn how to read the validation output, skipping over warnings reported for the invalid properties caused by browser-specific names.]

      That said, validation isn’t that important. It’s a tool that developers can use to help troubleshoot problems in their code. Passing validation isn’t a requirement for release.

    • 05.

      I really don’t care about the validation service like before. How many years we have to wait for something to become standard? Sorry but I want to use what is available NOW not when IE6 dies, after 5 or 6 years! Of course I keep my html valid and watch my CSS to work without critical errors. IMO properties starting with -prefix should not be treated like errors. What error is border radius? Sometimes the people who are making the standards have to look far from their nose.

    • 06.

      I strongly believe that there should be an option to use experimental features and still be valid. The purpose of validation is to spot errors, usually spelling errors, missed quotation marks, missed semi-colons, etc. Such real errors are hard to spot if they are hidden among tons of “not-really-errors”.

      From a teaching point of view validation is an exceptionally useful thing. It really helps my students.

      OTO, putting vendor specific code in separate files is a maintenance nightmare and does not work well in teaching situations.

    • 07.

      Actually, the CSSWG recommends dropping vendor prefixes at the Candidate Recommendation stage (not waiting until the full Recommendation stage). See the 2007 CSS Snapshot for details: http://www.w3.org/TR/css-beijing/#experimental So, for example, features from CSS3 Color no longer need prefixes.

    • 08.

      Like others have said, it’s not hard to simply skip over the vendor-specific errors when reading the validator’s output for your page, so I see it as a non-issue. It’s only an issue if you like to put validation icons on your site which I think are unnecessary – no-one’s really interested except other web developers.

      I’m also not above using CSS3 on client sites. There’s plenty of ways it can be implemented to non-essential design elements that add enhancements for modern browsers without causing problems in IE, e.g. text-shadow, RGBa, rounded corners.

    • 09.

      Like others have said, it’s not hard to simply skip over the vendor-specific errors when reading the validator’s output for your page, so I see it as a non-issue. It’s only an issue if you like to put validation icons on your site which I think are unnecessary – no-one’s really interested except other web developers.

      I’m also not above using CSS3 on client sites. There’s plenty of ways it can be implemented to non-essential design elements that add enhancements for modern browsers without causing problems in IE, e.g. text-shadow, RGBa, rounded corners.

    • 10.

      I think validation is very important, it has helped me find all sorts of subtle errors in my code. But it has frustrated me that the validator doesn’t have an “experimental” or “proprietary” flag for -vendor code.

      I think it would be best if the validator says that:

      “This document is using an experimental implementation of a proposed standard that may be changed at any time.”

      A notice instead of a warning or error would be good.

    • 11.

      CSS validation isn’t really that important compared to HTML validation. Seriously people who argue that you need a valid style sheet are just being anal retentive, I would suggest running it through the validator to double check syntax errors and that’s all it’s for really.

    • 12.

      Indeed, the “experimental” tag would be really handy. I’m not using CSS 3 for client work – apart from the reasons you mentioned I also try to make things work for IE 6 and that’s where everything stops.

      In my own projects I occasionally use some CSS 3 to add something extra (like text shadows) but the site doesn’t depend on it.

    • 13.

      @Neal – CSS expressions got dropped in IE8 so there is no longer a need to bother about them.

      @Ryan – In some countries (as far as I remember Australia is the case) every website / web application funded from public money need to validate against standards, so adopting newest CSS3 techniques seems to be a problem there. HTML validation is very important comparing to CSS validation which is a bit less but still important.

      In my opinion either marking browser extensions with a warning or as experimental would do the trick and help us a lot in adhering to and evangelizing Web Standards.

    • 14.

      I care about whether the syntax is valid (am I missing a semi-colon?) and whether the key:value properties are valid (I’m not passing a percentage to background-color.)

      I don’t care so much about how vendor specific prefixes aren’t in the spec (of course there aren’t, they’re vendor specific)

    • 15.

      They’re certainly not errors, and why would you warn someone about something that clearly has been intentionally implemented? Noting vendor properties is clearly the way to go.

      Since I started implementing CSS3 on my site I keep each browser and it’s respective rendering engine version separate from my main CSS 2.1 style sheet.

      There is simply no reason for all the ambiguity especially invalid warnings for things like “missing” background-color or color if one or the other is set…we KNOW as web designers that if something is not set text usually falls back to black and background-color (except on the body) falls back to transparent.

      Since serving my site as XHTML 1.1 (as application/xhtml+xml) I’ve had very little reason to use the (X)HTML validator…but the CSS validator has simply become a long running bad joke in my honest opinion. Not to mention the only way to really communicate with the people running it is on public mailing lists wild open to email harvesting bots. Brilliant!

      It’s time we saw some much more decisive leadership at the W3C in regards to these issues.

    • 16.
    • 17.

      @John: “There is simply no reason for all the ambiguity especially invalid warnings for things like “missing” background-color or color if one or the other is set…we KNOW as web designers that if something is not set text usually falls back to black and background-color (except on the body) falls back to transparent.”

      Actually, this is not true. Some users do not have black text or white backgrounds as their default. You should heed these warnings because they are correct.

    • 18.

      No need to have the W3C mess with their validator just to work with all the possible browser extensions. This would most likely introduce bugs and cause too much of a headache for them.

      Here are 2 things you can do to get around the errors:
      1) Put all your CSS3 files in a css3.css file and then when you validate everything in your regular .css files should pass and that one should fail.
      2) Put a /*CSS3*/ comment for each CSS3 line you have in your file, so when it gives an error you know why. This would work best if you put all your css3 rules as 1 line each.

    • 19.

      […] is a post on CSS3.info, The Big CSS3 Validation Debate where I left a comment I figured I’d make into a post here. It’s about how adding CSS3 […]

    • 20.

       I’m working on a redesign of my companies corporate site and using -vendor code CSS3 for drop shadows, rounded corners and a few other bits and bobs.
      We’re then supplying IE with a conditionally commented stylesheet that uses images to replace these effects. It’s a bit more work but seems to be holding up and allowing us to do nice things.

      Older versions of FF/Safari/etc will default to no shadows and square corners which is acceptable to us for such a small market share.

      Whilst it means the main stylesheet doesn’t validate, we get a better looking site via less bandwidth that way… cheaper for us and quicker for the user. Sometimes validation isn’t everything.

    • 21.

       The CSS validation issues surrounding CSS3 and vendor-specific extension started to become a concern for me on a couple of recent projects. I crafted a nice solution to these issues by using jQuery to apply the styles via scripting:

      $(document).ready(function() {
      $(‘.someClassName’).css({
      ‘border-radius’:’12px’,
      ‘-moz-border-radius’:’12px’,
      ‘-webkit-border-radius’:’12px’
      });
      }

      Obviously not ideal or useful for every context, but if CSS validation is an issue for you then this technique may help. I used jQuery for this example, but you could use any JavaScript library or roll your own script.

    • 22.

      @Bille D.

      I beg to disagree. That is not a “nice” solution.

      Using JavaScript for the sole purpose of cheating the validator – CSS or HTML – is defeating the whole purpose of validation.

      http://itpastorn.blogspot.com/2009/06/validation-and-doctype-myths-and.html

      Your code also reminded me of another snippet I wrote:

      http://itpastorn.blogspot.com/2009/06/do-not-put-experimental-features-last.html

    • 23.

       Personally, I use validation as a trouble-shooting tool rather than a launch requirement. If an element on my page is behaving in an unexpected way, my first trouble-shooting stop is to validate the html, then the css, and finally the javascript. I’d say that around half the issues I run into can be solved that way. When I am using CSS3, I don’t find it’s much of a problem to just skip the errors it’s causing in the validation, though I think it would probably be fine to simply mark those lines with a warning and call them out as experimental. That might be really helpful depending on which problems you’re trying to troubleshoot.

      I’ve also carefully started using CSS3, both in my own work and in work for clients. If the browser doesn’t support border-radius, then the page is not broken, it’s just lacking a rounded corner. In many cases, that’s perfectly acceptable both to me and my clients. As long as the CSS3 you’re using degrades gracefully in browsers that don’t support it, I see no issues with using it.

      @Jakub – With IE8 still accounting for a minority of IE’s share of the market, I’d hardly say it was time to stop worrying about CSS expressions. Those will be causing validation errors for some time to come. Perhaps, those too, could be marked as experimental.

    • 24.

      As long as it doesn’t damage brand integrity, then there is nothing wrong with gracefully degrading a clients website for older browsers.

    • 25.

      […] One interesting comment I read suggested that we separate the valid CSS and the CSS3 styles so that when css validation fails, we know why. Original article […]

    • 26.

      Validation isn't everything, but I do agree that it is a useful check that your code is semantic and correct. My personal approach is to keep all CSS3 elements in a separate file, thereby keeping my main stylesheet valid and "clean". The small hit on bandwidth is a small price top pay IMHO.

    • 27.

      I liked when you mentioned :
      – marking the code experimental; no warning or errors.
      – developers should not sell css3 code to their clients YET

    • 28.

      @Montoya Then that would be a suggestion, not a warning.

      A competent web designer will set the text color for paragraphs and spans to black even if they are black by default.

      So the warnings are completely out of context. At best these are suggestions and they are clearly and explicitly targeted at web designers who don’t understand this…yet they appear for everyone’s CSS. That’s like warning someone they could get in to a car accident just because they’re going to drive their car.

    • 29.
    • 30.

       What I do to solve the problem of validation is similar to the following:
      document.write(‘::selection {background: #ffb7b7; opacity:0.4; /* Safari */}::-moz-selection {background: #ffb7b7; opacity:0.8; /* Firefox */}’);

      I insert the css3 code with javascript, so that it displays properly and can be validated

    • 31.

       I just feel like they need to implement css3 already hell even css3 needs more stuff. There so many things that need to be worked on for CSS to be used efficiently and easily. Many of those codes are not available…so why are we still staying behind?

    • 32.

       I think it’s important for developers to use CSS3, even at this “early stage”, to push the technology and encourage the W3C to speed up their approval process (or whatever it is) – why the heck is it taking so long to make simple things like border-radius and rgba colors official??
      It does of course depend on the client. There’s nothing wrong with telling them – we can enhance this design using CSS3 but it may not look identical in all browsers. If that’s acceptable to them then why not do it, right. If they say no we don’t want that – well, it’s no sweat off my back.
      I’ve been using CSS3 more and more in my projects, personal and professional, going even as far as using webkit-transition. It doesn’t even work in FF of course, but the small animations effects are not paramount to the design, while to those that do see them it adds a nice touch.

    • 33.

      […] http://www.css3.info/the-big-css3-validation-debate/# VN:F [1.6.8_931]please wait…Rating: 0.0/5 (0 votes cast)VN:F [1.6.8_931]Rating: 0 (from 0 votes) […]

    • 34.

      I don’t care about css validation, because when I forgot to add «quote» mark or bracket, code highlight goes crazy after error, and I immediately fix it.

      And it’s not strong argument for me, not to use wendor-specific (like ::selection or -moz-box-shadow) properties, just because validator won’t pass it.

    • 35.

       I want to know about css3 n what is benefit to work with

    • 36.

      @matthew “What I do to solve the problem of validation is similar to the following:
      document.write(’::selection {background: #ffb7b7; opacity:0.4; /* Safari */}::-moz-selection {background: #ffb7b7; opacity:0.8; /* Firefox */}’);”

      This is the worst suggestion on this blog. Rubbish – do not use document.write. EVER. Use event handlers to run javascript as needed. NEVER use document.write. That is remedial school scripting.

      And using script to hide css from a validator is a a bad idea, anyway.

    • 37.
    • 38.

       I don’t know if this has been mentioned, but a trick we learnt when developing our Joomla template framework Morph, is to include browser specific stylesheets, then add the vendor specific css there.

      For example, -moz-border-radius would go in the firefox.css and -webkit-border-radius would go in chrome.css, safari.css or webkit.css. The neat part is because the validator is seen as its own browser “engine”, none of these browser specific stylesheets are included when the validation is done, thus any site using this method can take advantage of these vendor specific selectors and still have their site validate.

      Important to mention that this doesn’t work on the local validation service built into the Firefox Webdev toolbar, but it works 100% on the online “live” version of the validator (which is the one that counts anyways).

      Hope that helps ;)

      Cheers,
      Chris

    • 39.

      I just faced the same problem, but in my opinion, the validation services is there to help, it’s not a goal to validate and then brag about it with a shiny (not so much) icon. If I write colour instead of color, the validator will tell me and I’ll change it, but if I use -moz-something-awesome, I know what it does and that it works, no need for me to care about the “invalidity” of my site.

    • 40.

      Is there any other w3c valid way for overflow-x and overflow-y ?

    • 41.

       validation doesnt matter much if you written good css3 code.

    • 42.

      One thing you can do, is to place all your CSS3 specific rules in a separate stylesheet. The validator let’s you know which file it found the problem in. So for example, you have all your normal CSS in a file called “layout.css” and then all your CSS3 rules in a file called “ccs3.css”, then the validator will tell you if there’s anything invalid in each file. You can just ignore everything in the “css3.css” file and spot any errors or warnings in your “layout.css” file.

      This also allows you to easily make changes if anything changes.

    • 43.

      […] Since CSS3 hasn’t been officially released, using CSS3 may (and probably will) invalidate your CSS.  If you’re fine with that, use CSS3 to your heart’s content. Learn more about CSS3 validation. […]

    • 44.

      It seems like the color spec for css 3 is a Fluster Cuck. It seems like the goal is to standardize on all standards.

      To fully know CSS 3, you’ll have to know 4 color theories. Plus all those names for standard colors.

      Most people designing sites will use one, and that one will proliferate. The others will end up in depreciated limbo. I say go rgb OR hsl. Both are powerful and capable of displaying the many colors. [The alpha as a channel either hsl or rgb is a great thing….] If were that far down the road, why not throw in LAB, Pantone, and CMYK? We can call it Adobe CSS3.

    • 45.

      I’ve posted a possible compromise or solution for those who want to implement AND validate CSS3:

      http://www.bryanhadaway.com/how-to-link-to-the-w3c-css3-validation-page/

      Thanks, Bryan

    • 46.

      At the same time, I have to question whether or not the time has yet come for designers to be implementing CSS3 in their client projects. I think CSS3 is perfectly acceptable to be used in a designer’s own projects, and quite essential to promote the growth of CSS3, but is it really acceptable to sell a client experimental code that could cease to function at any time if the W3C ammends a specification, or browser vendors change the syntax with which a property is implemented?

      Agreed. I removed CSS3 from my current project after reading this.

    • 47.

       I strongly agree with the need for Validation and am pretty anal when it comes to making sure something is valid.

      But in todays market, clients always want something that looks different from everyone else, and want to stand out from the crowd.

      CSS3 offers this, but the validator for W3C is not allowing designers to use it without the errors. The requirement for validation is strong, and I feel that a site is incomplete if it doesn’t pass W3C validation.

      The fault isn’t that designers are using “Experimental Code”, the fault is that W3C are so bloody indecisive about what standards they want to keep and which ones they want to remove. CSS3 has been in development for a good while now, which is why the majority of browsers support similar standards.

      W3C need to change the errors into Experimental Tags. It is upto the designer to explain to their client that the styling uses CSS3 and it is their job to also ensure that the website remains compliant and functional.

      This is an easy fix if the website is displaying links to the validators from the individual pages.

      W3C need to adjust the validator, not designers ceasing to use CSS3. CSS3 gives us more beautiful websites, which we need on the web.

    • 48.

       Heres a nice little hack:

      Visit http://www.osinova.co.uk and note that border radius is used
      Now click the css validator and you see it passes

      Heres how to do it:

      .main {

      -moz-border-radius:10px;
      -webkit-border-radius:10px;
      border-radius:10px;

      border: 15px solid #222222;
      margin:auto;
      background:#FFF;
      width:760px;
      }

    • 49.

       Sorry Andrew, but…

      “Sorry! We found the following errors (3)
      URI : http://www.osinova.co.uk/
      82 .main Property -moz-border-radius doesn’t exist : 10px 10px
      83 .main Property -webkit-border-radius doesn’t exist : 10px 10px
      84 .main Property border-radius doesn’t exist in CSS level 2.1 but exists in : 10px 10px”

      the same is for CSS3 validation 8o)

    • 50.

      I might sound like weirdos but I am doing that since a decade… in vendor specific your overload your class and id whatever, think different don’t be a fake…, when you poooooo you swap your ass?, coding that’s the same.

OUR SPONSORS

Advertise here?
TAG CLOUD